<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ include file="../../include/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>中奖详情</title>
<script type="text/javascript" src="<c:url value='/scripts/boot.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/Portal.js'/>"></script>
<link rel="stylesheet" href="<c:url value='/scripts/portal.css'/>" />

<style type="text/css">
body {
	margin: 0;
	padding: 0;
	border: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
}
</style>
</head>
<body>
	<input type="hidden" name="action" id="action" class="mini-hidden">
	<form id="form1" method="post" enctype="multipart/form-data">
		<input type="hidden" name="id" id="recordId" class="mini-hidden">
		<input type="hidden" name="product.highestPrice" id="highestPrice" class="mini-hidden">
		<div
			style="padding-right: 11px; padding-left: 11px; padding-bottom: 5px; padding-top: 10px;">
			<fieldset style="border: solid 1px #aaa; padding: 3px;">
				<legend>夺宝详情</legend>
				<div style="padding: 5px;">

					<table style="table-layout: fixed;width:99%;">
						<tr>
							<td width="15%">期号：</td>
							<td width="35%">
								<input id='period' name='period' class='mini-textbox' readonly="readonly"/>
							</td>
							<td width="15%">商品名称：</td>
							<td width="35%">
								<input id='nameZh' name='nameZh' class='mini-textbox' readonly="readonly"/>
							</td>
						</tr>
						<tr>
							<td>金额：</td>
							<td>
								<input id='sellingPrice' name='sellingPrice' class='mini-textbox' />
							</td>
							<td>基数：</td>
							<td>
								<input id='minCount' name='minCount' width="120px" class='mini-textbox' readonly="readonly"/>元/次
							</td>
						</tr>
						<tr>
							<td>中奖人手机：</td>
							<td>
								<input id='mobile' name='mobile' class='mini-textbox' readonly="readonly"/>
							</td>
							<td>中奖人邮箱：</td>
							<td>
								<input id='email' name='email' class='mini-textbox' readonly="readonly"/>
							</td>
						</tr>
						<tr>
							<td>中奖号码：</td>
							<td>
								<input id='luckyNumber' name='luckyNumber' class='mini-textbox' readonly="readonly"/>
							</td>
							<td>开奖时间：</td>
							<td>
								<input id='completeTimeDate' name='completeTimeDate' class='mini-textbox' readonly="readonly"/>
							</td>
						</tr>
					</table>
				</div>
			</fieldset>
		</div>
		<!-- <div style="text-align: center; padding: 10px;">
			<a class="mini-button" onclick="onOk"
				style="width: 60px; margin-right: 20px;">保存</a> <a
				class="mini-button" onclick="onCancel" style="width: 60px;">取消</a>
		</div> -->
		<div style="text-align: center; padding: 12px;">
			<div id="datagrid1" class="mini-datagrid"
					style="width: 100%; height: 100px;" multiSelect="true"
					 idField="id"
					allowResize="true" 
					 allowCellEdit="true" showPager="false"
					allowCellSelect="true" editNextOnEnterKey="true"
					editNextRowCell="true">
					<div property="columns">
						<div field="customerInfo" width="150" headerAlign="center" align="center"
							cellStyle="padding:0;">客户名（邮箱或手机号）</div>
						<div field="count" width="50" headerAlign="center" align="center"
							cellStyle="padding:0;">购买份数</div>
						<div field="buyTimeDate" width="120" align="center"
							headerAlign="center" dateFormat="yyyy-MM-dd HH:mm:ss"
							allowSort="true">购买时间</div>
						<div field="amount" width="80" align="center"
							headerAlign="center">购买总价</div>
					</div>
				</div>
			</div>
	</form>
	<script type="text/javascript">
		mini.parse();
		var form = new mini.Form("form1");
		var grid = mini.get("datagrid1");
		
        var obj = new Object();
		var json = mini.encode(obj);
		/* grid.load({
			json:json
		}); */
        function onCloseClick1(e) {
            var lookup2 = mini.get("productId");
            lookup2.hidePopup();
        }
        function onClearClick(e) {
            var lookup2 = mini.get("productId");
            lookup2.deselectAll();
        }
		//标准方法接口定义
		function SetData(data) {
			mini.get("action").setValue(data.action);
			mini.get("recordId").setValue(data.id);
			if (data.action == "edit") {
				//跨页面传递的数据对象，克隆后才可以安全使用
				data = mini.clone(data);
				$.ajax({
					url : "<c:url value='/gamblingRecord/editVirtualPrize.action'/>",
					type : "post",
					data : {
						id : data.id
					},
					cache : false,
					success : function(text) {
						var o = mini.decode(text);
						var d = new Date(o.completeTime);
						o.completeTimeDate = d.format('yyyy-MM-dd HH:mm:ss');
						form.setData(o);
						if(o.email){
							o.customerInfo = o.email;
						}
						if(o.mobile){
							o.customerInfo = o.mobile;
						}
						var myArray=new Array();
						myArray[0] = o;
						grid.setData(myArray);
					}
				});
			}
		}
		function SaveData() {
			//$("form").submit();
			//表单验证
			form.validate();
			if (form.isValid() == false)
				return;
			var data = form.getData(); //获取表单多个控件的数据
			var json = mini.encode(data); //序列化成JSON
			var action = mini.get("action").getValue();
			var url;
			if ("edit" == action) {
				url = "<c:url value='/supper/updateSupperSubmit.action'/>";
			} else if ("new" == action) {
				url = "<c:url value='/supper/insertSupperSubmit.action'/>";
			} else {
				return;
			}
			var msgid = mini.loading("数据处理中，请稍后......", "处理数据");
			$.ajax({
				url : url,
				type : 'post',
				data : {
					json : json
				},
				cache : false,
				success : function(text) {
					mini.hideMessageBox(msgid);
					CloseWindow("save");
				},
				error : function(jqXHR, textStatus, errorThrown) {
					mini.hideMessageBox(msgid);
					mini.showMessageBox({
						showModal : false,
						width : 250,
						title : "提示",
						iconCls : "mini-messagebox-warning",
						message : jqXHR.responseText,
						timeout : 3000,
						x : "right",
						y : "bottom"
					});
				}
			});
		}
		function CloseWindow(action) {
			if (action == "close" && form.isChanged()) {
				if (confirm("数据被修改了，是否先保存？")) {
					return false;
				}
			}
			if (window.CloseOwnerWindow)
				return window.CloseOwnerWindow(action);
			else
				window.close();
		}
		function onOk(e) {
			SaveData();
		}
		function onCancel(e) {
			CloseWindow("close");
		}
		function onCloseClick(e) {
			var obj = e.sender;
			obj.setText("");
			obj.setValue("");
		}
		
		Date.prototype.format=function(fmt) {        
		    var o = {        
		    "M+" : this.getMonth()+1, //月份        
		    "d+" : this.getDate(), //日        
		    "h+" : this.getHours()%12 == 0 ? 12 : this.getHours()%12, //小时        
		    "H+" : this.getHours(), //小时        
		    "m+" : this.getMinutes(), //分        
		    "s+" : this.getSeconds(), //秒        
		    "q+" : Math.floor((this.getMonth()+3)/3), //季度        
		    "S" : this.getMilliseconds() //毫秒        
		    };        
		    var week = {        
		    "0" : "\u65e5",        
		    "1" : "\u4e00",        
		    "2" : "\u4e8c",        
		    "3" : "\u4e09",        
		    "4" : "\u56db",        
		    "5" : "\u4e94",        
		    "6" : "\u516d"       
		    };        
		    if(/(y+)/.test(fmt)){        
		        fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));        
		    }        
		    if(/(E+)/.test(fmt)){        
		        fmt=fmt.replace(RegExp.$1, ((RegExp.$1.length>1) ? (RegExp.$1.length>2 ? "\u661f\u671f" : "\u5468") : "")+week[this.getDay()+""]);        
		    }        
		    for(var k in o){        
		        if(new RegExp("("+ k +")").test(fmt)){        
		            fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));        
		        }        
		    }        
		    return fmt;        
		} 
	</script>

</body>
</html>